function seg_tissue(id)
sub_id = strcat('sub-',sprintf('%03d', id));
T1_path = strcat('/ibmgpfs/cuizaixu_lab/lizhilin/tPBM_5/data/anat/',sub_id,'/','T1.nii.gz')
if endsWith(T1_path, '.nii.gz')
    % 自动解压
    gunzip(T1_path);
    % 替换路径为解压后的 .nii
    T1_path = erase(T1_path, '.gz');
end
addpath('/ibmgpfs/cuizaixu_lab/lizhilin/tPBM_2/Package/spm12/spm12/');
addpath('/ibmgpfs/cuizaixu_lab/lizhilin/tPBM_2/Package/spm12/spm12/toolbox/cat12');
matlabbatch{1}.spm.tools.cat.estwrite.data = {strcat(T1_path,',1')};
matlabbatch{1}.spm.tools.cat.estwrite.nproc = 0;
matlabbatch{1}.spm.tools.cat.estwrite.opts.tpm =  {'/ibmgpfs/cuizaixu_lab/lizhilin/tPBM_2/Package/spm12/spm12/tpm/TPM.nii'};
matlabbatch{1}.spm.tools.cat.estwrite.opts.affreg = 'mni';
matlabbatch{1}.spm.tools.cat.estwrite.opts.biasstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.APP = 1070;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.LASstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.gcutstr = 2;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.regmethod.dartel.darteltpm =  {'/ibmgpfs/cuizaixu_lab/lizhilin/tPBM_2/Package/spm12/spm12/toolbox/cat12/templates_MNI152NLin2009cAsym/Template_1_Dartel.nii'};
matlabbatch{1}.spm.tools.cat.estwrite.extopts.registration.vox = 1.5;
matlabbatch{1}.spm.tools.cat.estwrite.output.labelnative = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.jacobianwarped = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.warps = [0 0];
matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.native = 1;%
matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.native = 1;%
matlabbatch{1}.spm.tools.cat.estwrite.output.surface = 1;
matlabbatch{1}.spm.tools.cat.estwrite.opts.accstr = 0.5;
matlabbatch{1}.spm.tools.cat.estwrite.extopts.segmentation.restypes.optimal = [1 0.1];%？？
matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.neuromorphometrics = 0;%
matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.lpba40 = 0;%
matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.cobra = 0;%
matlabbatch{1}.spm.tools.cat.estwrite.output.ROImenu.atlases.hammers = 0;%
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.native = 1;%
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.mod = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.GM.dartel = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.native = 1;%
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.mod = 1;
matlabbatch{1}.spm.tools.cat.estwrite.output.WM.dartel = 0;
matlabbatch{1}.spm.tools.cat.estwrite.output.bias.warped = 1;
cat12('expert');
spm_jobman('initcfg');
spm_jobman('run',matlabbatch);
end

